using ZR.Model.Enums;

namespace ZR.Model.BaseFrame.Dto
{
    /// <summary>
    /// 用户表单对象
    /// </summary>
    public class UserFormDtoBase
    {      
        /// <summary>
        /// 用户标识
        /// </summary>
        [Required(ErrorMessage = "用户标识不能为空")]
        public long UserId { get; set; }
        
        /// <summary>
        /// 账号
        /// </summary>
        [Required(ErrorMessage = "账号不能为空")]
        public string Account { get; set; }
        
        /// <summary>
        /// 真实姓名
        /// </summary>
        [Required(ErrorMessage = "真实姓名不能为空")]
        public string RealName { get; set; }
        
        /// <summary>
        /// 员工编号
        /// </summary>
        [Required(ErrorMessage = "员工编号不能为空")]
        public string EmployeeNo { get; set; }
        
        /// <summary>
        /// 部门
        /// </summary>
        [Required(ErrorMessage = "部门不能为空")]
        public long DepartId { get; set; }
        
        /// <summary>
        /// 电话
        /// </summary>
        public string Tel { get; set; }
        
        /// <summary>
        /// 手机号
        /// </summary>
        public string Mob { get; set; }
        
        /// <summary>
        /// 邮箱
        /// </summary>
        public string Email { get; set; }
        
        /// <summary>
        /// 性别
        /// </summary>
        public string Sex { get; set; }
        
        /// <summary>
        /// 生日
        /// </summary>
        public DateTime? Birth { get; set; }
        
        /// <summary>
        /// [QQ]
        /// </summary>
        public string Qq { get; set; }
        
        /// <summary>
        /// 备注
        /// </summary>
        public string Remark { get; set; }
        
        /// <summary>
        /// 状态
        /// </summary>
        [Required(ErrorMessage = "状态不能为空")]
        public string StateCode { get; set; }
        

    }

    /// <summary>
    /// 删除用户请求对象
    /// </summary>
    public class DeleteUserReqBase
    {
        /// <summary>
        /// 标识集合
        /// </summary>
        public string Ids { get; set; }
    }

    /// <summary>
    /// 变更用户状态请求对象
    /// </summary>
    public class ChangeUserStateReqBase
    {
        /// <summary>
        /// 标识
        /// </summary>
        public long Id { get; set; }
        
        /// <summary>
        /// 状态编码
        /// </summary>
        public string StateCode { get; set; }
        
        /// <summary>
        /// 状态枚举
        /// </summary>
        [JsonIgnore]
        public DataStateEnum? StateEnum
        {
            get
            {
                DataStateEnum stateEnum;
                var isOk = Enum.TryParse(StateCode, true, out stateEnum);
                if (isOk && Enum.IsDefined(stateEnum))
                {
                    return stateEnum;
                }
                return null;
            }
        }
    }


    /// <summary>
    /// 获取用户分页列表请求对象
    /// </summary>
    public class GetUserPageListReqBase : PagerInfo 
    {
        /// <summary>
        /// 树结点标识
        /// </summary>
        public long? TreeNodeId { get; set; }
        /// <summary>
        /// 是否是默认结点类型
        /// </summary>
        public bool IsDefaultNodeType { get; set; }=true;

        /// <summary>
        /// 关键词
        /// </summary>
        public string Keywords { get; set; }


    }

    /// <summary>
    /// 用户列表项
    /// </summary>
    public class UserListItemDtoBase
    {
        /// <summary>
        /// 用户标识
        /// </summary>
        public long UserId { get; set; }
        
        /// <summary>
        /// 账号
        /// </summary>
        public string Account { get; set; }
        
        /// <summary>
        /// 真实姓名
        /// </summary>
        public string RealName { get; set; }
        
        /// <summary>
        /// 部门
        /// </summary>
        public long DepartId { get; set; }
        
        public string BelongDepartName { get; set; }
        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime? CreateTime { get; set; }
        
        /// <summary>
        /// 创建人
        /// </summary>
        public string Creater { get; set; }
        
        /// <summary>
        /// 状态
        /// </summary>
        public string StateCode { get; set; }
        
    }

    /// <summary>
    /// 用户详情
    /// </summary>
    public class UserDetailDtoBase: UserFormDto
    {

    }
}